home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CPPictPartStubs.cpp
-
- Contains: ODPart methods unimplemented by PictPart. ODPart is purely
- abstract, so subclasses must provide implementations of all
- methods, even if they're just stubs. The stubs aren't all
- completely empty, but the non-empty ones return the appropriate
- "Duh?" response that tells the caller that the action was
- not handled.
-
- Written by: PartMaker
-
- Change History (most recent first):
-
- <3> 4/14/95 JS Updated for Developer Release 2
- <2> 3/8/95 JS Updated to b1c13/c14
- <1> 2/2/95 RA first checked in
- <0> PartMaker source by E, Soldan, T. Çelik, J. Alfke, R. Adkins, J. Schalk
- */
-
- #ifndef ODDebug
- #define ODDebug 0
- #endif
-
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
-
- #ifndef _CPPICTPART_
- #include "CPPictPart.h"
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- #ifndef _PLFMDEF_
- #include <PlfmDef.h>
- #endif
-
- //----------------------------------------------------------------------------------------
-
- #define qDebug 0
-
- #if qDebug
- #define WeBeHere(s) DebugStr((StringPtr)s)
- #else
- #define WeBeHere(s)
- #endif
-
-
- #ifdef applec
- #pragma segment PictPart
- #endif
-
-
- //----------------------------------------------------------------------------------------
- // Binding protocol
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::ExternalizeKinds(Environment* ev, ODTypeList* kindList)
-
- // Externalizes a representation for each 'kind' that it supports.
- //
- // The part should iterate through all the kinds in 'kindList',
- // and externalize a representation for each that it supports.
- // This call does not specify anything about the ordering of those
- // kinds in the contents property. Before calling this method,
- // you must ensure that the part supports a subset of the kinds
- // in 'kindList'. After executing this method successfully, the
- // contents property of the part has a value and representation
- // for each kind in kindListsupported.
-
- {
- WeBeHere("\pCPPictPart::ExternalizeKinds");
- ODUnused(kindList);
- this->Externalize(ev);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::ChangeKind(Environment* ev, ODType kind)
-
- // Asks a part to change into a new kind of content,
- // i.e. ask an ASCII Text part to change into a Styled Text part.
- //
- // The part should begin using the given kind as its primary kind
- // if it is supported. The first type of the first value in the
- // content property of the part's storage unit should become the
- // given kind. Before calling this method, you must ensure that the
- // part supports the specified kind. After this method is executed
- // successfully, the part's primary kind is the one that was
- // specified in the parameter, and the first type of the first
- // value in the content property of the part's storage unit is of
- // the specified type. When it reads in data, the part uses this
- // representation.
-
- {
- WeBeHere("\pCPPictPart::ChangeKind");
- ODUnused(kind);
- }
-
- //----------------------------------------------------------------------------------------
- // DragAndDrop protocol
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::FulfillPromise(Environment* ev, ODStorageUnitView *promiseSUView)
-
- // Fulfills a previously made promise by providing the actual
- // data the promise represents.
- //
- // The promiseSUView is a view into the same storage unit value
- // that is created by SetPromiseValue. The information about the
- // promise is encoded in the promiseSUView in the Part Handler's
- // own internal format. The promise data is written into the
- // promiseSUView replacing the data stored in the part handler's
- // format.
- //
- // When the promise was made, a record of it was kept by this part.
- // The promiseSUView contains the part's information for that promise.
- // The part uses the data in the promiseSUView to determine which
- // data to move/copy. The part then writes the data into the
- // promiseSUView.
- //
- // The format of a promise is determined by the part. The only
- // restriction is that a promise must be able to be written to
- // a Storage Unit Value.
- //
- // The destination part does not even know that the fulfilment
- // of a promise is taking place.
-
- {
- WeBeHere("\pCPPictPart::FulfillPromise");
- ODUnused(promiseSUView);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::DropCompleted(Environment* ev, ODPart* destPart, ODDropResult dropResult)
-
- // Notifies the part that the drop is completed.
- //
- // Called by the dragAndDrop object.
- //
- // DropCompleted is a peculiar method. If DragAndDrop::StartDrag is
- // synchronous, the return code to DragAndDrop::StartDrag is the
- // drop result. Part::DropCompleted does not need to be called.
- // However, if it is required that DragAndDrop::StartDrag returns
- // immediately, there needs to be a way to notify the result of the
- // drop. Before calling this method, you must ensure that the part
- // previously started an asynchronous drag.
-
- {
- WeBeHere("\pCPPictPart::DropCompleted");
- ODUnused(destPart);
- ODUnused(dropResult);
- }
-
-
- //----------------------------------------------------------------------------------------
- // Embedding protocol
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::ContainingPartPropertiesChanged(Environment* ev, ODFrame* displayFrame,
- ODStorageUnit* propertyUnit)
-
- // Used by ContainingPart to inform the contained part of
- // changes to the content properties of that object within
- // the containing part’s content model that encapsulates the
- // embedded frame.
- //
- // This method inspects “propertyUnit” for properties that this
- // part can understand. Where applicable, it incorporate those
- // properties into part's content data. It ignores inapplicable
- // properties, without signalling an error.
-
- {
- WeBeHere("\pCPPictPart::ContainingPartPropertiesChanged");
- ODUnused(displayFrame);
- ODUnused(propertyUnit);
- }
-
- //----------------------------------------------------------------------------------------
-
- ODStorageUnit* CPPictPart::GetContainingPartProperties(Environment* ev, ODFrame* displayFrame)
-
- // Used by an embedded part to create a storage unit and write
- // properties that the containing part associates with the
- // embedded frame into it, before returning it.
- //
- // Called by an embedded part.
-
- {
- WeBeHere("\pCPPictPart::GetContainingPartProperties");
- ODUnused(displayFrame);
- DebugStr("\pCPPictPart::GetContainingPartProperties -- shouldn't be here.");
- // Note that THROW, while valid under the temporary ASLM
- // implementation of OpenDoc, won't be correct when OpenDoc
- // is converted to SOM. Therefore we are using debug messages
- // for these types of errors. When SOM is available, this issue
- // will be addressed correctly.
- return kODNULL;
- }
-
- //----------------------------------------------------------------------------------------
-
- ODBoolean CPPictPart::RevealFrame(Environment* ev, ODFrame* embeddedFrame, ODShape* revealShape)
-
- // Asks a part to make an embedded frame visible.
- //
- // Called by an embedded part.
- //
- // This method scrolls one of this part's display frame's to make
- // the embedded frame visible therein. If this part has no visible
- // frames, it asks a containing part to reveal one of them. If no
- // display frames for the part currently exist, or if this part's
- // containing frame can't reveal the display frame, it opens a frame
- // in a new window.
-
- {
- WeBeHere("\pCPPictPart::RevealFrame");
- ODUnused(embeddedFrame);
- ODUnused(revealShape);
- DebugStr("\pCPPictPart::RevealFrame -- shouldn't be here.");
-
- return kODFalse;
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::EmbeddedFrameSpec(Environment* ev, ODFrame* embeddedFrame, ODObjectSpec* spec)
-
- // Creates an object specifier for the embedded frame.
- //
- // If this part is itself embedded, this method asks its containing
- // part for the specifier for the part's display frame, then
- // concatenates the specifier for that embedded frame.
-
- {
- WeBeHere("\pCPPictPart::EmbeddedFrameSpec");
- ODUnused(embeddedFrame);
- ODUnused(spec);
- DebugStr("\pCPPictPart::EmbeddedFrameSpec -- shouldn't be here.");
- }
-
- //----------------------------------------------------------------------------------------
-
- ODEmbeddedFramesIterator* CPPictPart::CreateEmbeddedFramesIterator(Environment* ev, ODFrame* frame)
-
- // Creates an object that will iterate over the frames that
- // are embedded within a display frame of this part.
- //
- // To indicate all the display frames, use kODNull for the frame
- // parameter.
-
- {
- WeBeHere("\pCPPictPart::CreateEmbeddedFramesIterator");
- ODUnused(frame);
- DebugStr("\pCPPictPart::CreateEmbeddedFramesIterator -- shouldn't be here.");
- return kODNULL;
- }
-
- //----------------------------------------------------------------------------------------
- // Frame protocol
- //----------------------------------------------------------------------------------------
-
-
- void CPPictPart::AttachSourceFrame(Environment* ev, ODFrame* frame, ODFrame* sourceFrame)
-
- // Called by the object that requested creation of a frame,
- // immediately after the creation of the frame.
- //
- // Calling this method associates a “source frame” with a display
- // frame of a part. This tells the part to keep two or more of its
- // display frames synchronized.
- //
- // A part will receive this call just after a display frame has
- // been added. Attaching a source frame should cause the display
- // frame to look identical to it. If presentations differ, it
- // causes the display frame to be equivalent to it. This causes
- // duplication of the embedded frames, and ensures that the view
- // in one frame is updated when content in the other is changed.
- // Before calling this method, you must ensure that both frame
- // and sourceFrame are display frames of the part.
- //
- // The part being displayed should take whatever action necessary
- // to synchronize the frames. As a minimum, if the two frames are
- // the same kind of presentation, it should duplicate embedded
- // frames in one frame into the other.
-
- {
- WeBeHere("\pCPPictPart::AttachSourceFrame");
- ODUnused(frame);
- ODUnused(sourceFrame);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::ViewTypeChanged(Environment* ev, ODFrame* frame)
-
- // Notifies the part that the viewType of one of its
- // frames has been changed.
- //
- // Parts must support all standard view types.
- // And they are ... ???
-
- {
- WeBeHere("\pCPPictPart::ViewTypeChanged");
- ODUnused(frame);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::PresentationChanged(Environment* ev, ODFrame* frame)
-
- // Notifies the part that the presentation kind of one
- // of its frames has been changed.
- //
- // Called by Frame::ChangeViewType().
- //
- // The part should examine the new view type via
- // frame->GetViewType(). If the part does not support that kind
- // of view type, it should correct the frame's viewType using
- // frame->SetViewType(). Note that parts MUST support the
- // standard set of view types (se HI spec). The part should then
- // adjust its display in the display frame to be of the new view
- // type.
-
- {
- WeBeHere("\pCPPictPart::PresentationChanged");
- ODUnused(frame);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::SequenceChanged(Environment* ev, ODFrame* frame)
-
- // Informs the part that the sequencing of a group of its
- // display frames has been changed.
- //
- // Called by containing part.
- //
- // The containing part of frame should call this when adding a new
- // frame to the group or re-ordering the frames in the group. A
- // single frame of the group is passed as an argument to indicate
- // which group of which containing frame has been changed.
-
- {
- WeBeHere("\pCPPictPart::SequenceChanged");
- ODUnused(frame);
- }
-
-
-
-
- //----------------------------------------------------------------------------------------
-
- ODFrame* CPPictPart::RequestEmbeddedFrame(Environment* ev, ODFrame* containingFrame,
- ODFrame* baseFrame,
- ODShape* frameShape,
- ODPart* embedPart,
- ODTypeToken viewType,
- ODTypeToken presentation,
- ODBoolean isOverlaid)
-
- // Asks the part to create a new frame and embed a part in it.
- //
- // This is only requested by embedded parts which want additional
- // frames in which to display in the same containing part.
- //
- // If this part is a containing part, it should ask the draft to
- // create a new frame, and embed the frame in its content.
- // “baseFrame” is another display frame of the same part, already
- // embedded in the same containing part. The frameShape parameter
- // is relative to the frame coordinate system of the baseFrame.
- // The containing part decides if it can fulfill the requests for
- // frameShape. - if not, it can create the frame where it wants
- // and with the shape it chooses. The containing part should assign
- // the new frame to the same frameGroup as the baseFrame. If
- // isOverlaid is true, the new frame should float above the part's
- // content, and should not have to negotiate for space with the part.
- // The viewType and presentation are just passed through to
- // Draft::CreateFrame().
- //
- // Note that RequestEmbeddedFrame should only be called by an embedded
- // part on its containing part in order to get a sibling frame. That
- // is why this call takes a baseFrame parameter. The baseFrame must
- // already be embedded inside the part receiving the
- // RequestEmbeddedFrame message.
-
- {
- WeBeHere("\pCPPictPart::RequestEmbeddedFrame");
- ODUnused(containingFrame);
- ODUnused(baseFrame);
- ODUnused(frameShape);
- ODUnused(embedPart);
- ODUnused(viewType);
- ODUnused(presentation);
- ODUnused(isOverlaid);
- DebugStr("\pCPPictPart::RequestEmbeddedFrame -- shouldn't be here.");
- return kODNULL;
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::RemoveEmbeddedFrame(Environment* ev, ODFrame* embeddedFrame)
-
- // Removes a frame used for viewing an embedded part.
- //
- // Called by an embedded part.
- //
- // It is called by an embedded part to indicate it no longer
- // needs the frame to display itself.
-
- {
- WeBeHere("\pCPPictPart::RemoveEmbeddedFrame");
- ODUnused(embeddedFrame);
- DebugStr("\pCPPictPart::RemoveEmbeddedFrame -- shouldn't be here.");
- }
-
- //----------------------------------------------------------------------------------------
-
- ODShape* CPPictPart::RequestFrameShape(Environment* ev, ODFrame* embeddedFrame, ODShape* frameShape)
-
- // Used by an embedded part to ask for a change in the
- // shape of its frame.
- //
- // Called by Frame::RequestFrameShape().
- //
- // This method decides what new shape to give the embedded frame,
- // using the requested “frameShape” as a guideline. It then
- // answers with what shape is actually granted as the return value.
- // The requestor must abide by the returned shape, though it may
- // make further requests for different shapes or additional frames.
-
- {
- WeBeHere("\pCPPictPart::RequestFrameShape");
- ODUnused(embeddedFrame);
- ODUnused(frameShape);
- DebugStr("\pCPPictPart::RequestFrameShape -- shouldn't be here.");
- return kODNULL;
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::UsedShapeChanged(Environment* ev, ODFrame* embeddedFrame)
-
- // Informs a containing part that the used shape of one of
- // its embedded frames has changed.
- //
- // Called by Frame::ChangeUsedShape().
- //
- // Containing parts that have arranged their content to conform
- // to the used shape of an embedded frame (as in text wrapping)
- // will need to adjust the layout of that content for the new
- // used shape.
-
- {
- WeBeHere("\pCPPictPart::UsedShapeChanged");
- ODUnused(embeddedFrame);
- }
-
- //----------------------------------------------------------------------------------------
-
- ODShape* CPPictPart::AdjustBorderShape(Environment* ev, ODFacet* embeddedFacet, ODShape* shape)
-
- // Adjusts the shape of the active frame border of an embedded
- // frame.
- //
- // Called by the arbitrator object.
- //
- // The “shape” parameter specifies the requested shape. The
- // return value specifies that shape as it is obscured by the
- // other contents of this part.
-
- {
- WeBeHere("\pCPPictPart::AdjustBorderShape");
- ODUnused(embeddedFacet);
- return shape;
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::CanvasChanged(Environment* ev, ODFacet* facet)
-
- // Notifies the part that one of its facets has been moved to
- // image on a different canvas.
- //
- // Called by the facet object.
- //
- // The part must update any internal state necessary for
- // compliance with this method.
-
- {
- WeBeHere("\pCPPictPart::CanvasChanged");
- ODUnused(facet);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::GeometryChanged(Environment* ev, ODFacet* facet,
- ODBoolean clipShapeChanged,
- ODBoolean externalTransformChanged)
-
- // Called by a facet of the part to inform it that the clipping
- // shape and/or external transform of that facet has changed.
- //
- // Called by the facet object.
- //
- // The part should use the new clip shape for display from now
- // on. Parts that display only in response to update events don't
- // need to do anything special, provided they check the clip
- // shape each time they draw. Parts that display asynchronously
- // (like clocks, movies, etc.) must notice their new clipping and
- // limit their display accordingly.
-
- {
- WeBeHere("\pCPPictPart::GeometryChanged");
- ODUnused(facet);
- ODUnused(clipShapeChanged);
- ODUnused(externalTransformChanged);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::FacetRemoved(Environment* ev, ODFacet* facet)
- {
- WeBeHere("\pCPPictPart::FacetRemoved");
- }
-
- //----------------------------------------------------------------------------------------
- // Imaging protocol
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::CanvasUpdated(Environment* ev, ODCanvas* canvas)
-
- // Notifies the part that a canvas that it owns has been
- // updated and that its contents need to be copied to its
- // parent canvas.
- //
- // Called by the facet object.
- //
- // The data must be copied from an off-screen canvas,
- // transformed, and then placed in the containing canvas.
-
- {
- WeBeHere("\pCPPictPart::CanvasUpdated");
- ODUnused(canvas);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::HighlightChanged(Environment* ev, ODFacet* facet)
-
- // Notifies the part that the highlight state of one of its
- // frames has been changed.
- //
- // Called by the frame object.
- //
- // It adjusts this part's presentation in the facet to its
- // new highlight state. New state may be found by calling
- // facet->GetHighlight(). It passes notification to embedded
- // parts.
-
- {
- WeBeHere("\pCPPictPart::HighlightChanged");
- ODUnused(facet);
- }
-
- //----------------------------------------------------------------------------------------
-
- ODULong CPPictPart::GetPrintResolution(Environment* ev, ODFrame* frame)
-
- // Returns the minimum desired resolution in dots per inch
- // that this part requires for printing the contents of the
- // specified frame.
- //
- // Called by part or the application and is used in performing
- // printing.
-
- {
- WeBeHere("\pCPPictPart::GetPrintResolution");
- ODUnused(frame);
- return 0;
- }
-
- //----------------------------------------------------------------------------------------
- // From Linking protocol
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::EmbeddedFrameChanged(Environment* ev, ODFrame* frame, ODChangeID change)
-
- // Notifies the containing part that the content displayed
- // in the argument “embedded frame” has changed.
- //
- // Called by an frame object belonging to an embedded part when
- // the frame object's ContentChanged method is called.
- //
- // The part should call the ContentChanged method of any of its
- // frames that would be interested in this information. This
- // method should only be called by frame objects. The part is
- // not responsible for passing this notification on to its
- // containing part. The part may ignore this notification if it
- // is uninterested in changes to embedded content. A part should
- // wait a certain length of time (a second perhaps) before
- // updating its display so that subsequent calls to
- // EmbeddedFrameChanged with the same ODChangeID don’t result
- // in multiple updates for the same change.After executing this
- // method successfully, the ContentChanged method of any of the
- // part's frames may have been called and the part may have
- // taken action to update its display.
-
- {
- WeBeHere("\pCPPictPart::EmbeddedFrameChanged");
- ODUnused(change);
- ODUnused(frame);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::LinkStatusChanged(Environment* ev, ODFrame* frame)
-
- // Allows the part to set the link status of any embedded frames.
- //
- // Called by a part's frame when that frame's ChangeLinkStatus
- // method is called.
- //
- // Frames notify their owner parts that their link status has
- // changed whenever ChangeLinkStatus is called. After this
- // method executes successfully, the part will call
- // ChangeLinkStatus on any embedded frames that are involved
- // in the link in question.
-
- {
- WeBeHere("\pCPPictPart::LinkStatusChanged");
- ODUnused(frame);
- }
-
- //----------------------------------------------------------------------------------------
- // Undo protocol
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::UndoAction(Environment* ev, ODActionData* actionState)
-
- // Tells the part to undo the action that is described by actionState.
- //
- // Called by the undo object.
-
- {
- WeBeHere("\pCPPictPart::UndoAction");
- ODUnused(actionState);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::RedoAction(Environment* ev, ODActionData* actionState)
-
- // Tells the part to Redo the action described by actionState.
- //
- // Called by the undo object.
-
- {
- WeBeHere("\pCPPictPart::RedoAction");
- ODUnused(actionState);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::DisposeActionState(Environment* ev, ODActionData* actionState,
- ODDoneState doneState)
-
- // Tells the part to dispose of the action data.
- //
- // Before calling this method, you must ensure that “actionState”
- // is an action data block previously logged by this part. After
- // calling this method successfully, memory for “actionState” has
- // been reclaimed. It is no longer usable to perform undo operations.
-
- {
- WeBeHere("\pCPPictPart::DisposeActionState");
- ODUnused(actionState);
- ODUnused(doneState);
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::WriteActionState(Environment* ev, ODActionData* actionState,
- ODStorageUnitView* storageUnitView)
-
- // Writes out the actionState data onto a StorageUnitView,
- // and externalizes the undoAction data to the storage unit.
- //
- // Called by the undo object.
-
- {
- WeBeHere("\pCPPictPart::WriteActionState");
- ODUnused(actionState);
- ODUnused(storageUnitView);
- }
-
- //----------------------------------------------------------------------------------------
-
- ODActionData CPPictPart::ReadActionState(Environment* ev, ODStorageUnitView* storageUnitView)
-
- // Internalizes the undoAction data from the storage unit.
- //
- // This method reads the actionState data from a view on a
- // StorageUnit. It then allocates the memory and passes ownership
- // of the storage to the caller.
-
- {
- WeBeHere("\pCPPictPart::ReadActionState");
- ODUnused(storageUnitView);
-
- ODActionData data;
- data._maximum = 0;
- data._length = 0;
- data._buffer = kODNULL;
- return data;
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::IncrementRefCount(Environment* ev)
- {
- WeBeHere("\pCPPictPart::IncrementRefCount");
- }
-
- //----------------------------------------------------------------------------------------
-
- void CPPictPart::ReleaseExtension(Environment* ev, ODExtension* extension)
- {
- WeBeHere("\pCPPictPart::ReleaseExtension");
- ODUnused(extension);
- }
-
- //----------------------------------------------------------------------------------------
-
- ODExtension* CPPictPart::GetExtension(Environment* ev, ODType extensionName)
- {
- WeBeHere("\pCPPictPart::GetExtension");
- ODUnused(extensionName);
-
- DebugStr("\pUntil the part implements extension support, this should not get called.");
-
- ev->_major = kODErrUnsupportedExtension;
- // If we are called with an extension type we don't support,
- // we should be returning an error here.
-
- return kODNULL;
- }
-
- //----------------------------------------------------------------------------------------
-
- ODBoolean CPPictPart::HasExtension(Environment* ev, ODType extensionName)
- {
- WeBeHere("\pCPPictPart::HasExtension");
- ODUnused(extensionName);
-
- return kODFalse;
- // No extension until you implement one for your part.
- }
-